'''
''' Deletes a record from the table.
'''
''' The table to delete from.
''' Nothing, or a filter that restricts which records get deleted.
''' Nothing, or the specific sort order in which the records get deleted.
''' The zero-based index of the first record to delete.
''' The exact number of records to delete.
''' The total number of matching records (ignoring page boundaries).
Public Overrides Sub DeleteRecords(ByVal table As BaseClasses.Data.TableDefinition, _
ByVal filter As BaseClasses.Data.BaseFilter, _
ByVal sortOrder As BaseClasses.Data.OrderBy, _
ByVal startIndex As Integer, ByVal count As Integer, ByRef totalCount As Integer)
' If we are deleting using a primary key, then
' just call the web service that deletes one record.
If Not filter Is Nothing AndAlso _
TypeOf filter Is PrimaryKeyValueFilter Then
Dim ${Primary Key} As Integer = Get${Primary Key}FromFilter(filter)
' Instantiate the object that will communicate with a web service.
' Replace "MyWebServiceForTableAccess" with the external web service name
Dim webService As New localhost.MyWebServiceForTableAccess
webService.Credentials = System.Net.CredentialCache.DefaultCredentials
' Call the web service's "DeleteRecord" function.
webService.Delete${${Table Name}RecordClassName}(${Primary Key})
totalCount = 1
Return
End If
' Else use the normal path to delete records, e.g. using stored procedures, or inline SQL.
' You can customize this to call your web service instead.
MyBase.DeleteRecords(table, filter, sortOrder, startIndex, count, totalCount)
End Sub
|